const Router = require('koa-router');
const router = new Router();
const axios = require('axios');


router.post('/deepseek/chat', async (ctx) => {
  // console.log(ctx.request.body);
  const message = ctx.request.body.content
  const data = {
    model: 'deepseek-r1:8b', // 模型名称
    messages: [
      {
        role: 'user', // 角色
        content: message
      }
    ],
    stream: false // 是否流式返回
  }

  const response = await axios.post("http://localhost:11434/api/chat", data)
  // console.log(response.data.message.content);
  ctx.body = {
    code: 200,
    content: response.data.message.content
  }
  
  
})
module.exports = {deepseek:router};